import sys
from time import time

from PIL import Image
import os
import ImageEnhance
import ImageFilter
import ImageDraw
import ImageOps


mainIm = Image.open( "dane_w1/png/dane_w10079.png" ).convert("RGB")
im1 = Image.open( "dane_w1/png/dane_w10079.png" )

contrast = ImageEnhance.Contrast(im1)
im1 = contrast.enhance(2.0).filter(ImageFilter.MedianFilter(7))
im2 = Image.open( "dane_w2/dane_w2_0079.png" )
im3 = Image.open( "dane_w3/dane_w3_0079.png" )
print mainIm.mode, mainIm.format
mainPM = mainIm.load()

width, height = mainIm.size
pixMap = [im1.load(),im2.load(),im3.load()]
for x in range( 0, width - 1 ):
    for y in range( 0, height - 1 ):
        mainPM[x,y] = (pixMap[2][x,y], pixMap[0][x,y], pixMap[1][x,y])
mainIm.save("all.png")
